package com.sixth.controller;


import com.sixth.entity.Backlightcolor;
import com.sixth.entity.Keyboardcolor;
import com.sixth.service.KeyboardcolorService;
import com.sixth.util.CommonResult;
import com.sixth.util.TableLayUi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: project01
 * @description:
 * @author: 老魏
 * @create: 2021-12-23 11:01
 **/
@RestController
@RequestMapping("/keyboardcolor")
public class KeyBoardColorController {
   @Autowired
  private KeyboardcolorService keyboardcolorService;

   @RequestMapping("/findAllKeyboardcolor")
  public TableLayUi findAllKeyBoardcolor(int page, int limit, Integer keyboardcolorid, String keyboardcolorname){
       TableLayUi tab =keyboardcolorService.findAllKeyboardcolor(page, limit, keyboardcolorid, keyboardcolorname);
     return  tab;
   }

   @RequestMapping("/deleteKeyboardcolor")
  public  CommonResult deleteKeyBoardcolor(Integer keyboardcolorid){
  return keyboardcolorService.deleteKeyboardcorlor(keyboardcolorid);
  }

  @RequestMapping("/addOrUpdateKeyboardcolor")
  public CommonResult addOrUpdateKeyboardcorlor(Keyboardcolor keyboard,String keyboardcolorname){
     if (keyboard.getKeyboardcolorid()!=null){
       return  keyboardcolorService.updateKeyboardcorlor(keyboard);
     }else {
       return  keyboardcolorService.addKeyboardcorlor(keyboardcolorname);
     }
  }
    @RequestMapping("/listByCondition")
    public TableLayUi listByCondition(int page, int limit,String keyboardcolorid , String keyboardcolorname ){
        return  keyboardcolorService.findboardCondition(page,limit,keyboardcolorid,keyboardcolorname);
    }
}
